# Copyright (c) 2009 by Pete Black <theblackpeter@gmail.com>

inherit eutils flag-o-matic qt4

DESCRIPTION="Kisa spell checks as you type!"
HOMEPAGE="http://www.kde-apps.org/content/show.php?content=67220"
SRC_URI="http://kisa.googlecode.com/files/${P}.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE="debug"

RESTRICT="nomirror"

DEPEND="$(qt4_min_version 4.3.2)
        >=app-text/aspell-0.60.5"
RDEPEND="${DEPEND}"

LANGS="sv"
for lang in ${LANGS}; do
	IUSE="${IUSE} linguas_${lang}"
done

src_unpack()
{
	unpack ${A}
	cd ${S}
}

src_compile()
{
	# remove unsupported languages, include en and en_US to suppress warning
	LANGS="en en_US ${LANGS}"
	strip-linguas $LANGS

	# now remove en and en_US, confusing? I know...
	LINGUAS=${LINGUAS/"en"}
	LINGUAS=${LINGUAS/"en_US"}

	if [[ -n ${LINGUAS} ]]; then
		echo
		einfo "Translations for the following languages will be installed:"
		einfo "${LINGUAS}"
		echo
	fi

	if use "debug"; then
		qmake CONFIG+="debug" LINGUAS="${LINGUAS}" kisa.pro || die "qmake failed"
	else
	  qmake LINGUAS="${LINGUAS}" kisa.pro || die "qmake failed"
	fi

	strip-unsupported-flags

	emake || die "make failed"
}

src_install()
{
	einstall INSTALL_ROOT="${D}" || die "install failed"

	dodoc ChangeLog COPYING README
}
